package org.rcy.framework.security.login;

import java.io.Serializable;

public class LoginDetails implements Serializable {
    private static final long serialVersionUID = -7786440454643910121L;
    private final String remoteAddress;
    private final String userAgent;

    public LoginDetails(String remoteAddress, String userAgent) {
        this.remoteAddress = remoteAddress;
        this.userAgent = userAgent;
    }

    public String getRemoteAddress() {
        return this.remoteAddress;
    }

    public String getUserAgent() {
        return this.userAgent;
    }

    public int hashCode() {
        int result = 1;
        result = 31 * result + (this.remoteAddress == null ? 0 : this.remoteAddress.hashCode());
        result = 31 * result + (this.userAgent == null ? 0 : this.userAgent.hashCode());
        return result;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        } else if (obj == null) {
            return false;
        } else if (this.getClass() != obj.getClass()) {
            return false;
        } else {
            LoginDetails other = (LoginDetails)obj;
            if (this.remoteAddress == null) {
                if (other.remoteAddress != null) {
                    return false;
                }
            } else if (!this.remoteAddress.equals(other.remoteAddress)) {
                return false;
            }

            if (this.userAgent == null) {
                if (other.userAgent != null) {
                    return false;
                }
            } else if (!this.userAgent.equals(other.userAgent)) {
                return false;
            }

            return true;
        }
    }

    public String toString() {
        return "LoginDetails [remoteAddress=" + this.remoteAddress + ", userAgent=" + this.userAgent + "]";
    }
}